package Textpackage;

import javax.ejb.*;

/**
 * This is the bean class for the RazdelBean enterprise bean.
 * Created 14.03.2007 21:34:48
 * @author SANYA
 */
public abstract class RazdelBean implements EntityBean, RazdelLocalBusiness {
    private EntityContext context;
    
    // <editor-fold defaultstate="collapsed" desc="EJB infrastructure methods. Click on the + sign on the left to edit the code.">
    // TODO Consider creating Transfer Object to encapsulate data
    // TODO Review finder methods
    /**
     * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
     */
    public void setEntityContext(EntityContext aContext) {
        context = aContext;
    }
    
    /**
     * @see javax.ejb.EntityBean#ejbActivate()
     */
    public void ejbActivate() {
        
    }
    
    /**
     * @see javax.ejb.EntityBean#ejbPassivate()
     */
    public void ejbPassivate() {
        
    }
    
    /**
     * @see javax.ejb.EntityBean#ejbRemove()
     */
    public void ejbRemove() {
        
    }
    
    /**
     * @see javax.ejb.EntityBean#unsetEntityContext()
     */
    public void unsetEntityContext() {
        context = null;
    }
    
    /**
     * @see javax.ejb.EntityBean#ejbLoad()
     */
    public void ejbLoad() {
        
    }
    
    /**
     * @see javax.ejb.EntityBean#ejbStore()
     */
    public void ejbStore() {
        
    }
    // </editor-fold>
    
    
    public abstract Integer getId();
    public abstract void setId(Integer id);
    
    public abstract int getRazdel();
    public abstract void setRazdel(int razdel);
    
    public abstract int getPodrazdel();
    public abstract void setPodrazdel(int podrazdel);
    
    public abstract int getPodpodrazdel();
    public abstract void setPodpodrazdel(int podpodrazdel);
    
    public abstract String getText();
    public abstract void setText(String text);
    
    public abstract int getFlagtext();
    public abstract void setFlagtext(int flagtext);
    
    
    public Integer ejbCreate(Integer id, int razdel, int podrazdel, int podpodrazdel, String text, int flagtext)  throws CreateException {
        if (id == null) {
            throw new CreateException("The field \"id\" must not be null");
        }
        if (text == null) {
            throw new CreateException("The field \"text\" must not be null");
        }
        
        // TODO add additional validation code, throw CreateException if data is not valid
        setId(id);
        setRazdel(razdel);
        setPodrazdel(podrazdel);
        setPodpodrazdel(podpodrazdel);
        setText(text);
        setFlagtext(flagtext);
        
        return null;
    }
    
    public void ejbPostCreate(Integer id, int razdel, int podrazdel, int podpodrazdel, String text, int flagtext) {
        // TODO populate relationships here if appropriate
        
    }
}
